// mutation是改变state属性的状态
//以下的方法名均被外界调用才能更改state属性
export default {
  /**
   * 点击标题选择城市时
   * cityInfo => { "cityId": "1", "cityName": "北京"}
   * @param {*} state state仓库保存的数据
   * @param {*} cityInfo 城市信息
   */
  selectCity: function (state, cityInfo) {
    state.cityName = cityInfo.cityName;
    state.cityId = cityInfo.cityId;
    try {
      localStorage.cityInfo = JSON.stringify(state);
    } catch (e) {}
  },
  /**
   * 点击首页图片时
   * @param {*} state 
   * @param {*} field 
   */
  selectField: function (state, field) {
    state.field = field;
    try {
      localStorage.cityInfo = JSON.stringify(state);
    } catch (e) {}
  }
}
